home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts26-11
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: borland c 4.5
- Date: Wed, 06 Mar 96 06:03:23 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4hj9r3$elu@sam.inforamp.net>
- References: <4h9uai$ecj@rzsun02.rrz.uni-hamburg.de>
- NNTP-Posting-Host: ts26-11.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4h9uai$ecj@rzsun02.rrz.uni-hamburg.de>,
- mleusch@rzdspc1.informatik.uni-hamburg.de (Michael Leuschner) wrote:
- >It seems that the c++ compiler is able to compile our
- >ANSI c sources but later the linker can't manage to link the mix of
- >c++ and c together...
- >
- >Does anyone have a clue?
- >Is the a known problem (and how can you solve it) ?
-
- I would be more certain if you could tell me what errors were occuring, but it
- might be a name-mangling problem. If you know its not a
- name-mangling problem then ignore this post. But generally, when declaring a
- C extern function in a C++ source, you specify...
-
- extern "C" void f();
-
- alternative you could specify the following syntax...
-
- #ifdef __cplusplus
- extern "C"
- #endif
- void f();
-
- you could also do the following...
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #include <cfile.h>
-
- #ifdef __cplusplus
- }
- #endif
-
- or you could even embed the __cplusplus demangling statements inside your
- header...
-
- #ifndef HELLO_H
- #define HELLO_H
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
-
- ..
-
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
- #endif /* HELLO_H */
-
- The solution you choose depends on your preferences, but I tend to use a
- mixture of all four methods.
-
- Agrivar
-